<template>

  <div class="_wz_trailerParameterDetails">
    <Form>
      <table cellpadding="0" cellspacing="0" border="0">
        <colgroup>
          <col width="13%">
          <col width="20%">
          <col width="13%">
          <col width="20%">
          <col width="13%">
          <col width="20%">
        </colgroup>
        <tbody>
        <tr>
          <td style="font-weight: 600;position:relative;text-align: center;font-size: 18px;" colspan="6">{{!!formData.trailerPlateNo ? formData.trailerPlateNo : '--'}} 挂车档案</td>
        </tr>
        <tr>
          <td colspan="2" rowspan="4">
            <div class="demo-upload-list">
              <div style="width: 100%;height: 100%; display: flex;align-items: center;justify-content: center;">
                <Image :src="!!formData.trailerImg?apiUrl.imgUrl+formData.trailerImg:'img/zwtpxd.png'" fit="contain" width=100% height=100% preview :preview-list="[!!formData.trailerImg?apiUrl.imgUrl+formData.trailerImg:'img/zwtpxd.png']" />
              </div>
            </div>
          </td>
          <td style="text-align: right;font-weight: 600;">车牌号</td>
          <td>{{!!formData.trailerPlateNo ? formData.trailerPlateNo : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">车架号</td>
          <td>{{!!formData.trailerFrameNo ? formData.trailerFrameNo : '--'}}</td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">营运证号</td>
          <td>{{!!formData.trailerOperationCertificateNo ? formData.trailerOperationCertificateNo : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">经营类型</td>
          <td>{{!!formData.deptTypeName ? formData.deptTypeName : '--'}}</td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">联系人</td>
          <td>{{!!formData.trailerContactsName ? formData.trailerContactsName : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">联系电话</td>
          <td>{{!!formData.trailerContactsPhone ? formData.trailerContactsPhone : '--'}}</td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">车主/业户</td>
          <td>{{!!formData.trailerOwnerName ? formData.trailerOwnerName : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">车主电话</td>
          <td>{{!!formData.trailerOwnerPhone ? formData.trailerOwnerPhone : '--'}}</td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">初登日期</td>
          <td>{{!!formData.trailerDrivingPermitRegisterDate ? formData.trailerDrivingPermitRegisterDate : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">发证日期</td>
          <td>{{!!formData.trailerDrivingPermitIssueDate ? formData.trailerDrivingPermitIssueDate : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">到期日期</td>
          <td>{{!!formData.trailerDrivingPermitExpireDate ? formData.trailerDrivingPermitExpireDate : '--'}}</td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">经营企业</td>
          <td colspan="3">{{!!formData.deptName ? formData.deptName : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">地理区域</td>
          <td>{{!!formData.provinceName ? formData.provinceName +' '+ formData.cityName +' '+formData.countyName : '--'}}</td>
        </tr>
        <tr>
          <td style="font-weight: 600;" colspan="6">详细信息</td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">挂车类型</td>
          <td>{{!!formData.trailerType ? formData.trailerType : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">挂车品牌</td>
          <td>{{!!formData.trailerBrand ? formData.trailerBrand : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">挂车型号</td>
          <td>{{!!formData.trailerModel ? formData.trailerModel : '--'}}</td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">核定总质量</td>
          <td>{{!!formData.trailerWeight ? formData.trailerWeight : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">核定载质量</td>
          <td>{{!!formData.trailerPermitWeight ? formData.trailerPermitWeight : '--'}}</td>
          <td style="text-align: right;font-weight: 600;">容积/体积</td>
          <td>{{!!formData.trailerTruckVolume ? formData.trailerTruckVolume : '--'}}</td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">备注</td>
          <td colspan="5" style="min-height:50px;padding:5px 10px;">{{!!formData.remark ? formData.remark : '--'}}</td>
        </tr>
        <tr>
          <td style="font-weight: 600;" colspan="6">相关照片</td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">行驶证照片</td>
          <td colspan="2">
            <div class="demo-upload-list">
              <div style="width: 100%;height: 100%; display: flex;align-items: center;justify-content: center;">
                <Image :src="!!formData.trailerLicenseImg?apiUrl.imgUrl+formData.trailerLicenseImg:'img/zwtpxd.png'" fit="contain" width=100% height=100% preview :preview-list="[!!formData.trailerLicenseImg?apiUrl.imgUrl+formData.trailerLicenseImg:'img/zwtpxd.png']" />
            </div>
            </div>
          </td>
          <td style="text-align: right;font-weight: 600;">营运证照片</td>
          <td colspan="2">
            <div class="demo-upload-list">
              <div style="width: 100%;height: 100%; display: flex;align-items: center;justify-content: center;">
                <Image :src="!!formData.trailerOperationCertificateImg ? apiUrl.imgUrl+formData.trailerOperationCertificateImg:'img/zwtpxd.png'" fit="contain" width=100% height=100% preview :preview-list="[!!formData.trailerOperationCertificateImg?apiUrl.imgUrl+formData.trailerOperationCertificateImg:'img/zwtpxd.png']" />
            </div>
            </div>
          </td>
        </tr>
        <tr>
          <td style="text-align: right;font-weight: 600;">挂车资料</td>
          <td colspan="5">
            <div style="min-height:50px;">
              <div style="width: 200px;overflow: hidden;display: inline-block;margin-right: 4px;" v-for="item,index in formData.imgEntityList">
                <div class="demo-upload-list">
                  <div style="width: 100%;height: 100%; display: flex;align-items: center;justify-content: center;">
                    <Image :src="!!item.imgUrl?item.imgUrl:'img/zwtpxd.png'" fit="contain" width=100% height=100% preview :preview-list="[!!item.imgUrl?item.imgUrl:'img/zwtpxd.png']" />
                  </div>
                </div>
                <div style="line-height: 30px;text-align: center;overflow: hidden;text-overflow:ellipsis;white-space: nowrap;height: 30px;background: #f3f3f3;border-radius: 4px;">{{item.imgName}}</div>
              </div>
            </div>
          </td>
        </tr>
        </tbody>
      </table>
      <!--      </Card>-->
    </Form>
  </div>
</template>
<script>


import {getCurrentInstance,inject,nextTick,reactive, toRefs,toRef,onBeforeMount,onMounted,onBeforeUpdate,onUpdated,onBeforeUnmount,onUnmounted, ref,defineComponent,toRaw,watch} from 'vue'
import { useRouter,useRoute } from "vue-router";

import { useMainStore } from '../../store'  //pinia 使用 类似 vuex
import { storeToRefs } from 'pinia'//pinia 使用 类似 vuex
const mainStore = useMainStore() //pinia 使用 类似 vuex

//reactive
export default defineComponent({
  name: 'trailerParameterDetails',//组件名称
  components: {},//组件引用
  props: ['selectData'],//接收来自父组件的数据
  setup (props,context) {


    const apiUrl = inject('$apiUrl'); // 变量全局化 后台地址
    const $axios = inject('$axiosInterceptor');// 变量全局化 axios
    const $ViewUIPlus = inject('$ViewUIPlus');//引用全局组件
    const router = useRouter();//路由跳转使用


    const state = reactive({
      formData: {},//车辆数据

    });


    //加载数据
    const loadData = ()=>{
      $axios.post(apiUrl.coreVehicleCoreTrailerInfo,{uuid:props.selectData.uuid}).then((res) => {
        if (!!res) {

          state.formData = res.data.data;//表单
          let imgList = [];
          res.data.data.coreTrailerImgList.forEach((k, i) => {
            k.imgUrl = that.apiUrl.imgUrl + k.imgUrl
            imgList.push(k);
          })
          state.formData.imgEntityList = imgList;//res.data.data.imgEntityList;//多图回显
        }
      }).catch((err) => {
        console.log("失败", err)
      })


    }


    // 其他的生命周期
    onBeforeMount (() => {//beforeMount挂载前状态 // console.log("App ===> 相当于 vue2.x 中 beforeMount")

    })
    onMounted (() => {//mounted 挂载结束状态  // console.log("App ===> 相当于 vue2.x 中 mounted")
      loadData()
    })

    // 注意，onBeforeUpdate 和 onUpdated 里面不要修改值
    onBeforeUpdate (() => {//beforeUpdate 更新前状态 // console.log("App ===> 相当于 vue2.x 中 beforeUpdate")

    })

    onUpdated (() => {//updated 更新完成状态 // console.log("App ===> 相当于 vue2.x 中 updated")

    })

    onBeforeUnmount (() => {//beforeDestroy 销毁前状态  // console.log("App ===> 相当于 vue2.x 中 beforeDestroy")
    })

    onUnmounted (() => {//destroyed 销毁完成状态  // console.log("App ===> 相当于 vue2.x 中 destroyed")
    })

    return {
      ...toRefs(state),
      apiUrl,
    }
  }
})


</script>
<style lang="less">
._wz_trailerParameterDetails{
  height: 100%;
  overflow: auto;

  table {
    table-layout:fixed;
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 12px !important;

    td {
      min-width: 0;
      height: 40px;
      box-sizing: border-box;
      text-align: left;
      text-overflow: ellipsis;
      border: 1px solid #515a6e;
      padding: 0 10px;
      word-break: break-word;
    }
  }

  .demo-upload-list {
    margin: 5px auto;
    width: 200px;
    height: 140px;
    text-align: center;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    position: relative;

    img {
      min-height: 10%;
      max-height: 90%;
      min-width: 10%;
      max-width: 90%;
      //width: 100%;
      //height: 100%;
    }
  }
}
</style>
